package valerij_timakov.home_finances.web.listeners;

import java.io.File;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import org.apache.log4j.PropertyConfigurator;

/**
 * Application Lifecycle Listener implementation class Log4jInit
 *
 */
@WebListener
public class Log4jInit implements ServletContextListener {

	public void contextInitialized(ServletContextEvent event) {
		String homeDir=event.getServletContext().getRealPath("/");
		File propertiesFile=new File(homeDir,"WEB-INF/log4j.properties");
		PropertyConfigurator.configure(propertiesFile.toString());
    }

	public void contextDestroyed(ServletContextEvent arg0) {}
	
}
